﻿@using Webdiyer.WebControls.Mvc
@model PagedList<Alabama.JobRegister>
<h3>
    Đăng ký lịch công tác</h3>
<div class="row-fluid">
    <div class="row-fluid">
        <div class="span12">
            @Html.ActionLink("Tạo mới", "NewOrEdit", null, new { @class = "btn btn-info addNewItem" })
            @Html.ActionLink("Sửa", "NewOrEdit", null, new { @class = "btn btn-info EditItem" })
            @Html.ActionLink("Xóa", "Delete", null, new { @class = "btn btn-danger DeleteItem confirmDelete" })
        </div>
    </div>
    <table class="table">
        <tr>
            <th style="width:3%">
                <input type="checkbox" name="" value="" class="checkAll" />
            </th>
            <th style="width:10%">
                Họ tên
            </th>            
            <th>
                Người thực hiện
            </th>
            <th>
                Nội dung
            </th>
            <th style="width:10%">
                Địa điểm
            </th>
            <th style="width:10%">
                Thời gian thực hiện
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    <input type="checkbox" name="checkOwner" value="@item.ID" class="checkitem"/>
                </td>
                <td>
                    @(item.UserID.HasValue?item.User.Name:"")
                </td>               
                <td>
                    @item.NguoiThucHien
                </td>
                <td>
                    @item.Content
                </td>
                <td>
                    @(item.Location)
                </td>
                <td>
                    @String.Format("{0:dd/MM/yyyy HH:mm}", item.DateFrom)
                </td>
            </tr>
        }
    </table>
    <div class="row-fluid">
        <div class="span4">
            <div class="dataTables_info">
                @if (Model.TotalItemCount > 0)
                {
                    if (Model.TotalItemCount < Model.PageSize)
                    {
                    <span>1 </span>
                    <span>- </span>@Model.TotalItemCount
                    }
                    else
                    {
                    <span></span>@((Model.CurrentPageIndex - 1) * Model.PageSize + 1)
                    <span>- </span>@((Model.CurrentPageIndex != Model.TotalPageCount) ? (Model.CurrentPageIndex * Model.PageSize) : Math.Abs((Model.CurrentPageIndex) * Model.PageSize - (Model.PageSize * Model.TotalPageCount) - Model.TotalItemCount))
                    }
                    <span>of </span>@(Model.TotalItemCount)
                            
                }
            </div>
        </div>
        <div class="span8">
            <div class="dataTables_paginate paging_bootstrap pagination phantrangmvcpager">
                @Html.Pager(Model, new PagerOptions { ContainerTagName = "ul", PageIndexParameterName = "page", CurrentPagerItemWrapperFormatString = "<li class='active'>{0}</li>", CurrentPageNumberFormatString = "{0}", FirstPageText = "&laquo; ", LastPageText = " &raquo;", NextPageText = "Trang sau →", PrevPageText = "← Trang trước", SeparatorHtml = "" })
            </div>
        </div>
    </div>
</div>
